package cn.plushine.service;

import cn.plushine.mapper.BasePOrderMapper;
import cn.plushine.pojo.Goods;
import cn.plushine.pojo.POrder;
import cn.plushine.pojo.POrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;


/**
 * 采购订单接口实现类
 */
@Service
public class BasePOrderServiceImpl implements BasePOrderService {

    @Autowired
    BasePOrderMapper basePOrderMapper;

    // 获取采购订单
    @Override
    public List<POrder> get() {
        return basePOrderMapper.get();
    }

    // 获取品牌列表
    @Override
    public List<Goods> getGoods() {
        return basePOrderMapper.getGoods();
    }

    // 获取获取单位（默认价格和供应商）
    @Override
    public Goods getUnit(int id) {
        return basePOrderMapper.getUnit(id);
    }

    // 添加采购订单
    @Override
    public int addPOrder(String id, Date date, int salesperson, String inputId) {
        return basePOrderMapper.addPOrder(id, date, salesperson, inputId);
    }

    // 添加采购记录
    @Override
    public int addPOrderItem(POrderItem pOrderItem, List<HashMap> ids, String pOrderId) {
        return basePOrderMapper.addPOrderItem(pOrderItem, ids, pOrderId);
    }

    // 取消采购订单
    @Override
    public int cancel(String id) {
        return basePOrderMapper.cancel(id);
    }
}
